package cn.hh.ymcc.feign;

import cn.hh.ymcc.enums.GlobalExceptionCode;
import cn.hh.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFallbackFactory implements FallbackFactory<CourseFeignClient> {


    @Override
    public CourseFeignClient create(Throwable throwable) {
        return new CourseFeignClient() {
            @Override
            public JSONResult info(String courseIds) {
                return  JSONResult.error(GlobalExceptionCode.SERVICE_ERROR.getMessage());
            }
        };
    }


}
